//get 10 to 20
var getRandNum = function () {
	return Math.ceil(Math.random()*10+10);
}
var runProgress = function (ele,config) {
	var width = window.outerWidth;
	var tempWidth = 0;
	var timer = setInterval(function () {
		tempWidth =  ele.offsetWidth+getRandNum();
		if(tempWidth>width){
			tempWidth = width;
		}
		if(tempWidth===width){
			clearInterval(timer);
			setTimeout(function () {
				ele.style.display='none';
				if(config && config.afterHidden){
					config.afterHidden();
				}
			},500)
		}
		ele.style.width=tempWidth+'px';
	},10)
}
//app entrance
window.onload = function() {
	runProgress(document.querySelector(".progress-bar"),{
		afterHidden:function () {
			document.querySelector('.content').style.display='block';
		}
	});
}

